﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MyVoteMVC.Models
{
    public class Activity
    {
        public Activity()
        {
            ChildActivities = new List<Activity>();
            Messages = new List<Message>();
            Questions = new List<Question>();
            Tickets = new List<Ticket>();
        }
        /// <summary>
        /// PK Guid
        /// </summary>
        public string ID { get; set; }

        /// <summary>
        /// 用于记录二轮活动的父活动ID
        /// </summary>
        public string PID { get; set; }

        /// <summary>
        /// 自编序号，用于显示
        /// </summary>
        public string No { get; set; }

        /// <summary>
        /// 活动标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 活动描述
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 活动开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 活动结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 活动投票详细结果是否显示用户名
        /// </summary>
        public int? IfShowUser { get; set; }

        /// <summary>
        /// 活动投票详细是否完全显示（或只显示当前用户的票）
        /// </summary>
        public int? IfReadAll { get; set; }

        /// <summary>
        /// 活动是否单人支持多次投票
        /// </summary>
        public int? IfMultiSubmit { get; set; }

        /// <summary>
        /// 创建人（姓名）
        /// </summary>
        public string Created_By { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? Created_Date { get; set; }

        /// <summary>
        /// 创建使用方法
        /// </summary>
        public string Created_Action { get; set; }

        /// <summary>
        /// 最后更新人（姓名）
        /// </summary>
        public string Last_Update_By { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime? Last_Update_Date { get; set; }

        /// <summary>
        /// 更新使用方法
        /// </summary>
        public string Last_Update_Action { get; set; }

        /// <summary>
        /// 活动打开次数
        /// </summary>
        public int? View_Count { get; set; }
        public int? Ticket_Count { get; set; }

        public string CurrentState { get; set; }
        public string Memo { get; set; }

        //LazyLoad
        /// <summary>
        /// 相关父活动
        /// </summary>
        public virtual Activity ParentActivity { get; set; }

        /// <summary>
        /// 相关子活动
        /// </summary>
        public virtual ICollection<Activity> ChildActivities { get; set; }

        /// <summary>
        /// 相关消息
        /// </summary>
        public virtual ICollection<Message> Messages { get; set; }

        /// <summary>
        /// 相关问题
        /// </summary>
        public virtual ICollection<Question> Questions { get; set; }

        /// <summary>
        /// 相关票据
        /// </summary>
        public virtual ICollection<Ticket> Tickets { get; set; }

        /// <summary>
        /// 相关头像
        /// </summary>
        public virtual ActivityImage Image { get; set; }

    }

    public class ActivityImage
    {
        public ActivityImage()
        {
          
        }

        /// <summary>
        /// PK Guid
        /// </summary>
        [Key]
        public string ID { get; set; }

        /// <summary>
        /// 活动头像
        /// </summary>
        public byte[] Image { get; set; }
    }
}
